/**
 * Copyright (c) 2019, ShangHai YTO Co., Ltd.
 * All right reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF YTO
 * CO., LTD.  THE CONTENTS OF THIS FILE MAY NOT BE DISCLOSED
 * TO THIRD PARTIES, COPIED OR DUPLICATED IN ANY FORM, IN WHOLE OR IN PART,
 * WITHOUT THE PRIOR WRITTEN PERMISSION OF YTO
 * CO., LTD.
 */
package org.sc.xl.test;

import org.apache.http.client.fluent.Request;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;

/**
 * @description: TODO 请在此添加描述
 * @reason: TODO ADD REASON(可选)
 * @author FXL
 *
 * @date 2023/8/21 14:00 
 * @since JDK 1.8
 */
public class HttpClientTestDemo {


    public static void main(String[] args) {
        try {
            byte[] content = Request.Get("https://camel-prd-sub-driver-upload.oss-cn-qingdao.aliyuncs.com/upload/bde3503b-8c3f-46a0-9fcb-b994fa5847d6.jpg")
                    .connectTimeout(5000).socketTimeout(5000)
                    .execute().returnContent().asBytes();
            BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(new File("C:\\Users\\admin\\Desktop\\1.jpg")));
            out.write(content);
            out.flush();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}